import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { getLocale } from "@/lib/i18n/server"; import { t } from "@/lib/i18n"; import { getDataset, listPapers } from "@/lib/papers/queries"; import { PaperRow } from "@/components/paper-items"; export const revalidate = 300; export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise { const { slug } = await params; const x = await getDataset(slug); const locale = await getLocale(); return x ? { title: locale === "fr" ? x.name_fr : x.name_en, alternates: { canonical: `/datasets/${slug}` } } : {}; } export default async function DatasetPage({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const locale = await getLocale(); const d = t(locale); const x = await getDataset(slug); if (!x) notFound(); const res = await listPapers({ dataset: [slug], sort: "recent", perPage: 100 }); const rows: [string, string | null][] = [[d.datasets.provider, x.provider], [d.datasets.coverage, x.coverage], [d.datasets.frequency, x.frequency], [d.datasets.access, x.access_conditions], [d.datasets.license, x.license]]; return (

{d.papers.dataset}

{locale === "fr" ? x.name_fr : x.name_en}

{rows.filter(([, v]) => v).map(([k, v]) =>
{k}
{v}
)}{x.url &&
URL
{x.url}
}
{d.datasets.access}
{x.is_public ? d.datasets.public : d.datasets.restricted}
{(locale === "fr" ? x.description_fr : x.description_en) &&

{locale === "fr" ? x.description_fr : x.description_en}

}

{res.total} {res.total === 1 ? d.topics.paper : d.topics.papers}

{res.items.map((p) => )}
); }